package 线程状态;

/**
 * @Author: 李佳芬
 * @Description: Sleep睡眠
 * @DateTime: 2023/3/31 16:36
 **/
public class TestSleep implements Runnable{

    // 倒计时
    @Override
    public void run() {
       int i= 10;
       do {
          try {
             Thread.sleep(1000);
             System.out.println(i--);
          } catch (InterruptedException e) {
             e.printStackTrace();
          }
       } while (i > 0);
    }

    public static void main(String[] args) {
       TestSleep sleep = new TestSleep();
       new Thread(sleep).start();

    }
}
